package com.tc.dispatch.csservice.test;

import com.tc.dispatch.csservice.model.Product;
import java.lang.reflect.Field;
import java.lang.reflect.Method;

/**
 * <p>Title: </p>
 * <p>Description: </p>
 * <p>Copyright: Copyright (c) 2008</p>
 * <p>Company: zju</p>
 * @author jakcyjia
 * @version 1.0
 */

public class CSTestClassAttribute {
  public CSTestClassAttribute() {
    Product p=new Product();
    Field[] arr=p.getClass().getDeclaredFields();
    System.out.println(arr.length);
    try{
      for (int i = 0; i < arr.length; i++) {


        Method me= p.getClass().getMethod("get"+arr[i].getName().substring(0,1).toUpperCase()+arr[i].getName().substring(1),null);

        Object o1=me.getReturnType().newInstance();
       // (me.getReturnType().getName())o1;
        System.out.println(i + ":" + arr[i].getName() + "--- value:" +
                          me.invoke(p,null));
      }
    }
    catch(Exception e)
    {
      System.out.print(e.getMessage());
    }
  }
  public static void main(String[] args) {
    CSTestClassAttribute CSTestClassAttribute1 = new CSTestClassAttribute();
  }

}